<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <script src="/assets/libs/jquery/dist/jquery.min.js"></script>
</head>
<body>
<div id="content"></div>
<script>
    function getParameterFromUrl(name) {
        var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
        return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
    }

    var article_id = getParameterFromUrl('article_id');

    let url = 'api/index/articleInfo?article_id='+article_id;

    getdata()

    function getdata() {
        $.ajax({
            url: 'https://jj.jaja666.com/'+url,
            type: 'POST', // 或者 'POST' 如果需要发送数据
            success: function (response) {

                content = response.data.content;
                $('title').text(response.data.title);

                const unifiedHtml = unifyFontStyles(content, '36px', '1.6');
                document.getElementById('content').innerHTML = unifiedHtml;
            },
            error: function (error) {
                // 处理错误情况
                console.error("请求失败", error);
            }
        });
    }


    function unifyFontStyles(html, fontSize = '16px', lineHeight = '1.5') {
        console.error(123)
        // 创建临时DOM元素
        const tempDiv = document.createElement('div');
        tempDiv.innerHTML = html;

        // 获取所有元素
        const allElements = tempDiv.getElementsByTagName('*');

        // 遍历所有元素并设置统一的字体样式
        for (let i = 0; i < allElements.length; i++) {
            const element = allElements[i];
            // 设置字体大小
            element.style.fontSize = fontSize;
            // 设置行高
            element.style.lineHeight = lineHeight;
        }

        // 返回处理后的HTML
        return tempDiv.innerHTML;
    }

</script>
</body>
</html>